//
//  LXUserInfoView.m
//  cat
//
//  Created by imera on 16/1/18.
//  Copyright © 2016年 LX. All rights reserved.
//

#import "LXUserInfoView.h"

#define LXUserInfoViewMargin 10

@implementation LXUserInfoView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if(self){
        [self initSubViews];
    }
    return self;
}

- (void)initSubViews
{
    /*** 用户头像 */
    UIButton *userPhoto = [[UIButton alloc]init];
    [userPhoto setBackgroundImage:[UIImage imageNamed:@"U5I%NZFJ7[DNM)AI(~OMOZD"] forState:UIControlStateNormal];
    CGFloat userPhotoX = LXUserInfoViewMargin;
    CGFloat userPhotoY = LXUserInfoViewMargin;
    CGFloat userPhotoW = 50;
    CGFloat userPhotoH = 50;
    userPhoto.frame = CGRectMake(userPhotoX, userPhotoY, userPhotoW, userPhotoH);
    [self addSubview:userPhoto];
    
    /*** 用户姓名 */
    UILabel *userName = [[UILabel alloc]init];
    userName.text = @"点击用户头像登录";
    userName.font = [UIFont systemFontOfSize:13];
    CGSize userNameSize = [userName.text sizeWithAttributes:@{NSFontAttributeName:userName.font}];
    CGFloat userNameX = userPhotoX;
    CGFloat userNameY = CGRectGetMaxY(userPhoto.frame) + LXUserInfoViewMargin;
    CGFloat userNameW = userNameSize.width;
    CGFloat userNameH = userNameSize.height;
    userName.frame = CGRectMake(userNameX, userNameY, userNameW, userNameH);
    [self addSubview:userName];
}
@end
